<template>
	<view class="statistics">
		<view style="height: 20px;"></view>
		<view class="charts-box">
			<qiun-data-charts type="line" :chartData="chartData" />
		</view>
		<view style="height: 20px;"></view>
		<view class="charts-box">
			<qiun-data-charts type="column" :chartData="chartData2" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				chartData: {
					"categories": [],
					"series": [{
						"name": "面试题统计",
						"data": []
					}]
				},
				chartData2: {
					"categories": [],
					"series": [{
						"name": "平台面试数量",
						"data": []
					}]
				}
			}
		},
		onLoad() {
			
			this.getListColumn();
			this.getList();
			
		},
		methods:{
			getListColumn:function(){
				let _this = this;
				uni.request({
					url:'http://39.106.207.209:8100/interview/getQuestStaticsData',
					success(res) {
						_this.chartData.series[0].data = res.data.data
						let arr = [];
						for (var i = 0; i < res.data.data.length; i++) {
							arr.push(i+1)
						}	
						_this.chartData.categories= arr
					}
				})
			},
			getList(){
				let _this = this;
				uni.request({
					url:'http://39.106.207.209:8100/interview/getPlatStaticsData',
					success(res) {
						for (var i = 0; i < res.data.data.length; i++) {
							_this.chartData2.categories.push(res.data.data[i].platname)
							_this.chartData2.series[0].data.push(res.data.data[i].platcount)
						}	
					}
				})
			}
		}
	}
</script>

<style>
	.charts-box {
		height: 250px;
	}
</style>
